<%@ page import="icu.ikuns.User" %><%--
  Created by IntelliJ IDEA.
  User: Reimu
  Date: 2022/5/6
  Time: 23:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>login</title>
</head>
<body>
<form action="" method="post">
    用户：<input type="text" name="userName" ><br><br>
    密码：<input type="password" name="passWord"><br><br>
    <input type="checkbox" name="remember" value="remember">记住密码 <br>
    <input type="submit" value="登录">
</form>
<%
    String mUserName = request.getParameter("userName");
    String mPassword = request.getParameter("password");
    if (mUserName != null && mPassword != null) {
        String mrem = request.getParameter("remember");
        int expiry = 0;
        if (mrem != null) {
            expiry = 60 * 60 * 24 * 7;
        }
        Cookie c1 = new Cookie("userName", mUserName);
        c1.setMaxAge(expiry);
        response.addCookie(c1);
        Cookie c2 = new Cookie("password", mPassword);
        c2.setMaxAge(expiry);
        response.addCookie(c2);
        User user = new User(mUserName, mPassword);
    }
%>
</body>
</html>
